<?php
class Zend_View_Helper_LeftMenu {
	
   	public function leftMenu($menu) 
   	{
   		$s = $this->buildSubMenu($menu, true);
   		return $s;
	}
	
	private function buildSubMenu($menu, $first = false) {
		$s = '<ul'.($first ? ' id="site-left-menu" ' : '').'>';
	    foreach ($menu as $page) {
	    	if ($page->hasPages()) {
	    		$s .= '<li><span><a href="'.$page->getHref().'">'.$page->getLabel().'</a></span>';
	    		$s .= $this->buildSubMenu($page->getPages());
	    		$s .= '</li>';
	    	}
	    	else {
	    		$s .= '<li><a href="'.$page->getHref().'">'.$page->getLabel().'</a></li>';
	    	}
	    }
	    $s .= '</ul>';
	    return $s;
	}
}

?>